
<%@ page import="com.asisto.model.Tarea" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Create Tarea</title>

        <gui:resources components="['datePicker']"/>
        <g:javascript src="jquery/jquery-ui-i18n.js"/>

        <g:javascript>
            function creaDatePicker(id) {
              var fecha = ${formatDate(format:'dd/MM/yyyy', date:new Date())};
              jQuery.datepicker.setDefaults(jQuery.extend({showMonthAfterYear: false}));
              jQuery(id).datepicker(
                {showOn: 'button', buttonImage: "${resource(dir:'images',file:'date.png')}", buttonImageOnly: true}
              );

              $(id).datepicker('option', $.extend({showMonthAfterYear: false},
                $.datepicker.regional['es']));

              jQuery(id).datepicker('setDate',fecha);
            }
        </g:javascript>

    </head>
    
    <body class="yui-skin-sam">
        <div class="nav">
            <span class="menuButton"><a class="home" href="${resource(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">Tarea List</g:link></span>
        </div>
        <div class="body">
            
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${tareaInstance}">
            <div class="errors">
                <g:renderErrors bean="${tareaInstance}" as="list" />
            </div>
            </g:hasErrors>

            <g:form action="save" method="post">
              <div class="dialog">
                  <div class="formulario">
                    <div class="titulo">Crear tarea</div>

                      <div class="campo">
                          <div class="etiqueta">Empleado: </div>
                          <div class="valor ${hasErrors(bean:tareaInstance,field:'empleado','errors')}">
                              <g:select optionKey="id" from="${com.asisto.model.Empleado.list()}" name="empleado.id" value="${tareaInstance?.empleado?.id}" ></g:select>
                          </div>
                      </div>

                      <div class="campo">
                          <div class="etiqueta">Descripcion: </div>
                          <div class="valor ${hasErrors(bean:tareaInstance,field:'descripcion','errors')}">
                              <g:textField name="descripcion" value="${tareaInstance?.descripcion}"/>
                          </div>
                      </div>


                      <div class="campo">
                          <div class="etiqueta">Fecha inicio:</div>
                          <div class="valor">
                              <input type="text" name="fecha1" id="fechaInicio" class="datepicker" value="xxx" />
                          </div>
                          <div class="valor">
                              <g:select class="corto" name="horaInicio" from="${8..24}" ></g:select>
                          </div>

                          <div class="valor">
                              :
                          </div>

                          <div class="valor">
                              <g:select class="corto" name="minutosInicio" from="${['00','15','30','45']}" ></g:select>
                          </div>
                    </div>

                      <div class="campo">
                          <div class="etiqueta">Fecha fin:</div>
                          <div class="valor">
                              <input type="text" name="fecha2" id="fechaFin" class="datepicker" value="xxx" />
                          </div>
                          <div class="valor">
                              <g:select class="corto" name="horaFin" from="${8..24}" ></g:select>
                          </div>

                          <div class="valor">
                              :
                          </div>

                          <div class="valor">
                              <g:select class="corto" name="minutosFin" from="${['00','15','30','45']}" ></g:select>
                          </div>
                    </div>

                    <div class="campo">
                    </div>


                    
                  </div>
                    <div class="botones">
                        <input class="save" type="submit" value="Crear" />
                    </div>


              </div>

                <jq:jquery>
                    jQuery(function() {
                      creaDatePicker('#fechaInicio');
                      creaDatePicker('#fechaFin');
                    });
                </jq:jquery>

            </g:form>
            <!--
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="fechaInicio">Fecha Inicio:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:tareaInstance,field:'fechaInicio','errors')}">
                                    <input type="text" name="fecha1" id="datepicker" class="datepicker" value="xxx" /><br/>
                                    <g:select name="horaInicio" from="${8..24}" ></g:select> :
                                    <g:select name="minutosInicio" from="${['00','15','30','45']}" ></g:select>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="fechaFin">Fecha Fin:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:tareaInstance,field:'fechaFin','errors')}">
                                  &nbsp;
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="empleado">Empleado:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:tareaInstance,field:'empleado','errors')}">
                                    <g:select optionKey="id" from="${com.asisto.model.Empleado.list()}" name="empleado.id" value="${tareaInstance?.empleado?.id}" ></g:select>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="empleado">Descripcion:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:tareaInstance,field:'descripcion','errors')}">
                                    <g:textField name="descripcion" value="${tareaInstance?.descripcion}"/>
                                </td>
                            </tr>

                        
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="Create" /></span>
                </div>
                
                <input type="text" name="fecha2" id="datepicker2" class="datepicker" value="xxx" />



            </g:form>
            -->
        </div>
    </body>
</html>
